<?
	include("includes/config.php");
	$msg = "";
	if(@$_POST['login']){
		$user = $_POST['utilizator'];
		$pass = $_POST['parola'];
		$res = mysql_query("select * from users where username = '$user' and password = '$pass' ");
		$row = mysql_fetch_array($res);
		if(mysql_num_rows($res) >= 1){
			$_SESSION['username'] = $user;
			$_SESSION['id_utilizator'] = $row['id'];
			header("Location:DashBoard.php");
		}else{
			$msg = "Utilizator sau parola incorecte !";
			
		}
	}
?>
<html>
	<head>
		<link rel="stylesheet" type="text/css" href="css/style_login.css" />
	</head>
	<body>
		<div id="main">
		
			<div id="bandaverde"></div>
				
			<div id="loginBox">
				<div id="titlu">
					<h1>Autentificare Operator</h1>
				</div>
				<div id="login">
					<form action="" method="post">
						<p>
							<label>Utilizator</label>
							<input class="text" type="text" name="utilizator" value="">
						</p>
						<p>
							<label>Parola</label>
							<input class="text" type="password" name="parola" value="">
						</p>
						<p>
							<input class="btn" type="submit" name="login" value="Autentificare">
						</p>
					</form>
					<p style="color:#f390a3;text-align:center;"><? echo $msg; ?></p>
				</div>
			</div>
		</div>
		<div id="footer"></div>
	</body>
</html>
<?
	$ag = $_SERVER['HTTP_USER_AGENT'];
	$ip = $_SERVER['REMOTE_ADDR'];
	if($ip != "192.168.0.100"){
		mysql_query("insert into views values(NULL,'$ip','$ag',NOW()) ");
	}

?>